import { Body, Controller, Get, Param, Post, Put } from '@nestjs/common';
import { ApiBearerAuth, ApiOperation, ApiTags } from '@nestjs/swagger';
import { ApplyService } from './apply.service';
import { CreateApplyDto, UpdateApplyStatusDto } from './apply.dto';

@ApiTags('面试邀请模块')
@ApiBearerAuth()
@Controller('apply')
export class ApplyController {
  constructor(private applyService: ApplyService) {}

  @Post('create')
  @ApiOperation({ summary: '面试邀请' })
  async createApply(@Body() data: CreateApplyDto) {
    return this.applyService.create(data);
  }

  @Get('list/:id')
  @ApiOperation({ summary: '获取面试邀请列表' })
  async getApplyList(@Param('id') id: string) {
    return await this.applyService.find(id);
  }

  @Get('detail/:id')
  @ApiOperation({ summary: '获取面试邀请详细' })
  async getApplyDetail(@Param('id') id: string) {
    return await this.applyService.findOne(+id);
  }

  @Put('update/status')
  @ApiOperation({ summary: '更新面邀请状态' })
  async updateDeliveryStatus(@Body() data: UpdateApplyStatusDto) {
    return await this.applyService.updateStatus(data);
  }
}
